package com.neuedu.corejava.ch6.practise;

public class Goods {
//编写一个商品的类，要求包含商品名称和商品价格，并且编写一个方法能够在控制台输出“商品名：价格”。并在主函数中调用。
	//输出示例：
    //可乐：2.5
     //鼠标：50
	private  String name;
	private  double  price;
	
	
	public Goods() {
		super();
	}


	public Goods(String name, double price) {
		super();
		this.name = name;
		this.price = price;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public double getPrice() {
		return price;
	}


	public void setPrice(double price) {
		this.price = price;
	}
	
	public  void show() {
		System.out.println("名称："+name+";"+"  价格："+price);
	}


	public static void main(String[] args) {
		Goods goods=new Goods();
		goods.setName("可乐");
		goods.setPrice(2.5);
		goods.show();
		
		Goods goods1=new Goods();
		goods1.setName("鼠标");
		goods1.setPrice(50);
		goods1.show();

	}


	
	
	

}
